*******************************************************************************
* Load candidates data
*******************************************************************************

use dataset_candidates, clear

*******************************************************************************
* Re-shape to bullet level
*******************************************************************************

keep text* *gold* *author* *ideo*
drop ideo_author
drop ideology
drop if mi(text1)
gen id = _n
reshape i id
reshape j bullet
reshape xij text `rtr' goldtext ideology ideo_author
reshape xi
reshape long
duplicates drop text, force

*******************************************************************************
* Bullet-level correlation
*******************************************************************************

cor ideology ideo_author

*******************************************************************************
* Cross-tabulation
*******************************************************************************

replace ideology = -1 if ideology <= -.3333
replace ideology = 0 if inrange(ideology, -.3333, .3333)
replace ideology = 1 if ideology >= .3333

eststo clear
bys ideo_a: eststo: quietly estpost tab ideology, nototal

*******************************************************************************
* Output
*******************************************************************************

label define ideolab -1 "Raters <= -0.33" 0 "-0.33 < Raters < 0.33" ///
	1 "Raters >= 0.33"
label values ideology ideolab

#delimit;

esttab
	using "_output/tableS2.tex"
	,
		replace
		main("b")
		aux("pct" "%20.00fc")
 		mtitles("Author=-1" "Author=0" "Author=1")
		noobs
		nonum
 		booktabs
 		width(0.75\linewidth)
		nonote
		varlabels(
			-1 "Raters <= -0.33"
			0 "-0.33 < Raters < 0.33"
			1 "Raters >= 0.33"
		)
		;
		
#delimit cr

*******************************************************************************
* End
*******************************************************************************
